<aside class="main-sidebar">

    <section class="sidebar">

        <!-- Sidebar user panel -->
        <div class="user-panel">
            <div class="pull-left image">
                <img src="<?= $directoryAsset ?>/img/user2-160x160.jpg" class="img-circle" alt="User Image"/>
            </div>
            <div class="pull-left info">
                <p><?=\Yii::$app->user->identity->username ?></p>

                <a href="#"><i class="fa fa-circle text-success"></i> 在线</a>
            </div>
        </div>

        <ul class="sidebar-menu tree">
            <li class="header">菜单</li>
        </ul>
        <div class="header">sd</div>
        <?php
            $callback = function ($menu)
            {
                $base = ['label' => $menu['name'], 'url' => [$menu['route']], 'items' => $menu['children']];
                if (trim($menu['data']) != '')
                {
                    $base += json_decode($menu['data'], TRUE);
                }
                if (! isset($base['icon'])) {
                    $base['icon'] = 'fa  fa-circle-thin';
                }

                return $base;
            };
            $items = \mdm\admin\components\MenuHelper::getAssignedMenu(Yii::$app->user->id, 3, $callback);

            $config = [
                'options' => ['class' => 'sidebar-menu tree', 'data-widget'=> 'tree'],
//                'encodeLabels'    => false,
//                'activateParents' => true,
               // 'linkTemplate'    => '<a href="{url}"><i class="fa fa-circle-o"></i>  <span>{label}</span></a>',
               // 'submenuTemplate' => '<ul class="treeview-menu">{items}</ul>',
                'items'           => $items
            ];
            echo dmstr\widgets\Menu::widget($config);
        ?>
    </section>

</aside>
